package generator;

import java.util.ArrayList;
import java.util.List;

import core.course.Course;

/**
 * A bank containing all the available courses in the Technion.
 * 
 * @author omerlevy
 */
public class CourseBank {

	/* --- Constructors --- */
	
	/**
	 * Constructor.
	 */
	public CourseBank() {
		courses = new ArrayList<Course>();
	}
	
		
	/* --- Methods --- */
	
	/**
	 * Adds a new course to the bank, and endows it with a unique ID.
	 * @param course The new course.
	 */
	public void addCourse(Course course) {
		course.setId(courses.size());
		courses.add(course);
	}
	
	/**
	 * @param id A course's ID.
	 * @return The corresponding course or <code>null</code> if no course has 
	 * that ID.
	 */
	public Course getCourse(int id) {
		return courses.get(id);
	}
	
	/**
	 * @return The number of available courses.
	 */
	public int getNumCourses() {
		return courses.size();
	}
	
	
	/* --- Members --- */
	

	public List<Course> getCourses()
	{
		return courses;
	}


	/** All of the available courses. */
	private List<Course> courses;
	
}
